﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using BOHVote.BLL;
using BOHVote.Entity;
 

namespace BOH.Interview
{
    public partial class showquestion : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["QID"] != null && Request.QueryString["ApplyID"]!=null)
                {
                    string mod  = "1";
                    if(Request.QueryString["mod"]!=null&&!string.IsNullOrEmpty(Request.QueryString["mod"].ToString()))
                    {
                        mod = Request.QueryString["mod"].ToString();
                    }

                    ShowQuestion(Request.QueryString["QID"].ToString(), Request.QueryString["ApplyID"].ToString(),mod);
                    
                }
            }
        }

        public void ShowQuestion(string QID,string ApplyID,string mod)
        {
            DataSet dst = InterviewClass.getQuestionByID(QID);
            if (mod.Trim() == "2")
            {
                InterviewClass.UpdateCanUse(QID, "2");
            }
            if (dst != null && dst.Tables[0].Rows.Count > 0)
            {
                labQuestionContent.Text = dst.Tables[0].Rows[0]["Question_Content"].ToString();
                //labQuestionTitle.Text = dst.Tables[0].Rows[0]["Question_Title"].ToString();
                labQuestionAnswer.Text = dst.Tables[0].Rows[0]["Question_Answer"].ToString();
                //InterviewClass.UpdateInterviewStatus(QID, "D");
                if(Session["User"]!=null)
                {
                    BHUser bu = (BHUser)Session["User"];
                    InterviewClass.SaveQustionCheck(QID,bu.UserID,dst.Tables[0].Rows[0]["Question_Subject"].ToString(),ApplyID);
                }
            }
        }
    }
}
